package com.pshdhx.aiagent.rag;

import jakarta.annotation.Resource;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.chat.model.ChatModel;
import org.springframework.ai.rag.Query;
import org.springframework.ai.rag.preretrieval.query.expansion.MultiQueryExpander;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @Author pansd
 * @Date 2025-07-07 21:09
 * @Des 自定义扩展查询器
 */
@Configuration
public class MultiExpandProptConfig {

    ChatClient.Builder chatClientBuilder;



    public MultiExpandProptConfig(ChatModel dashscopeChatModel) {
        this.chatClientBuilder = ChatClient.builder(dashscopeChatModel);
    }


    public List<Query> expandPrompt() {
        MultiQueryExpander queryExpander = MultiQueryExpander.builder()
                .chatClientBuilder(this.chatClientBuilder)
                .numberOfQueries(3)
                .build();
        List<Query> expandList = queryExpander.expand(new Query("pshdhx能力怎么样?"));
        return expandList;
    }

}
